package 算法.NiuKe.JZ;

import 算法.NiuKe.ListNode;

/**
 * @author:谢君臣
 * @Date:2021/3/2019:32
 * @version:1.0
 * @function:
 */
public class JZ15 {
    public static void main(String[] args) {

    }
    public ListNode ReverseList(ListNode head) {
        if (head==null)
            return head;
        ListNode p=head;
        while (p.next!=null){
            ListNode next = new ListNode(p.next.val,null);
            p.next= p.next.next;
            next.next = head;
            head = next;
        }
        return head;
    }
}
